Repository navigation
Conversation
- IFlowOperator 新增 default getIdentity()/getIdentityAttributes(),下游存量实现零改动即可编译 - 新增 OperatorIdentity:null 与空串统一归一化为默认身份,供全链路比较与存储复用 - FlowRecord 增加发起/提交/当前/转交/干预五组身份字段,FlowTodoRecord 增加三组身份字段 - FlowRecordEntity/FlowTodoRecordEntity 与 Convertor 双向映射,历史数据 identity 为 null 时读取归一化为空串 - GroovyScriptRequest 暴露 getCreatedOperatorIdentity/getCurrentOperatorIdentity/getSubmitOperatorIdentity - FlowOperator 响应体携带身份,保留 (id, name) 双参构造器保证下游源码兼容 - P1 不改变任何判定逻辑与待办合并键格式,identity 为空时行为与历史一致 Closes #288
Open
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #289 +/- ##
============================================
+ Coverage 74.30% 76.05% +1.74%
- Complexity 2004 2102 +98
============================================
Files 270 278 +8
Lines 8256 8589 +333
Branches 981 1026 +45
============================================
+ Hits 6135 6532 +397
+ Misses 1630 1545 -85
- Partials 491 512 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
P2 透传与隔离: - FlowOperatorGateway 新增 default get(id, identity),下游存量实现零改动;IRepositoryHolder 同步新增 getOperatorById(id, identity) - FlowOperatorLocalThreadCache 缓存键由 userId 升级为 (userId, identity),同一人两个身份不再串味 - 请求体统一支持 operatorIdentity:create/action/revoke/delete/urge/detail/processNodes/reissue/forceSync/subProcessReset - REST 层新增 operatorIdentity 参数(与 operatorId 对称),未传时取当前登录操作者身份 - getTodoKey 采用兼容追加策略:默认身份保持历史格式,非空身份追加 #identity,升级中的存量待办合并关系不断裂 - 待办/已办/抄送查询按 (operatorId, identity) 过滤,默认身份用 coalesce(identity,'') 覆盖历史 NULL 行 - FlowRecordContent 列表响应补充发起/提交/当前三组身份,供前端列表展示 P3 判定升级为 (userId, identity): - WorkflowStrategyManager.verifyOperator 增加身份比较(审批参与人校验) - 撤销/删除/催办/子流程重置的记录归属校验加入身份 - OperatorManager(加签/减签/转交/委托)按人员+身份匹配 - 加签待办队列查重、减签目标解析按 (userId, identity) 去重 - 提交人==审批人的自动通过判定、流程干预人识别加入身份 - 详情/流程树/延迟触发/子流程会话/转交/delegate 等按记录身份回查操作者 文档与升级: - 新增 docs/Integration/operator-identity.md(模型、SPI、请求参数、脚本用法、兼容性与限制) - 新增 docs/Integration/sql/0.3.0-operator-identity.sql(加列 + 索引建议 + 达梦说明 + 自检 SQL) - 示例工程 FlowOperatorGatewayImpl/User 提供身份参考实现(返回带身份的副本,避免污染持久化上下文) 验证:./mvnw clean install 全量通过,453 个用例 0 失败(framework 430 / infra 6 / api 2 / starter 8 / example 7)。 新增用例 13 个:待办合并键身份维度 4、缓存身份隔离 4、审批判定身份 3、待办查询身份隔离(含历史 NULL)2。 Closes #288
- IBeanFactory / FlowScriptContext 新增 getOperatorById(userId, identity),default 实现走 GatewayContext - GroovyScriptBind 新增 $bind.getOperatorByIdentity(userId, identity),脚本可让指定人员以指定身份参与, 例如审批人脚本返回 [$bind.getOperatorByIdentity(2, 'department1')] - 文档补充脚本用法示例
This was referenced Nov 23, 2026
基于 PR #289 的评审结论,修复 6 个衍生问题并补齐用例: #290 详情页 currentNodeOperators 改为按 (人员id, 身份) 复合键去重, 排除当前操作人时也同时比较身份,避免同一人的第二个身份被吞掉。 #291 Mock 待办 / 已办 / 抄送查询补齐身份隔离重载,与真实 JPA 口径一致 (历史 NULL 身份按默认身份命中),带 mockKey 的联调不再串味。 #292 人员指定支持 (人员id, 身份) 二元组:新增 OperatorKey 与 operatorSelectOperators,分配表 JSON 兼容 [1,2,3] 与对象数组两种格式, 无需新增列 / DDL;PassAction 与 InitiatorSelectNodeService 统一用 hasAssignment 判定,兼容存量 map、新字段及发起时已落库的分配; 二次发起连同身份一起复制。 #293 网关与仓储持有者补批量取人身份重载,线程缓存按 (id, identity) 隔离; 流程树改为按记录身份分组预加载,消除多身份场景的 N+1 回查。 #294 新增 OperatorIdentity.validate(长度 64 / 禁止 # 与控制字符), 实体列宽与 DDL 对齐;落库前校验、读取仍宽松; 新增 OperatorIdentityGuard 对身份静默降级输出去重 WARN; clearNotify 同步清理 forwardOperatorIdentity。 #295 新增 25 个用例:多身份真实流程、Mock 查询隔离、脚本按身份取人、 批量身份缓存、身份校验与告警、转交身份清理、当前节点待审批人。 全量 478 用例 0 失败(原 453)。 文档:operator-identity.md 补充批量重载、人员指定、Mock 口径与写入约束; 升级 SQL 说明人员分配表无需改表。 Refs #290, #291, #292, #293, #294, #295
Contributor
Author
代码评审整改已合入本分支针对本 PR 的评审结论,已创建跟踪议题 #290–#295,并在提交
验证: 仍需人工闭环:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
issue #288:用户多身份流程参与能力。本 PR 一次性交付 P1 + P2 + P3,分三次提交,可按提交逐个复核:
a5199a036e71220c07425ab2一、能力模型
身份是不透明字符串,框架只做透传、存储、比较,不建组织模型、不做身份授权校验、不冻结身份名称。
OperatorIdentity统一normalize/isDefault/of/same,null与空串等价。二、P1(已交付,无行为变更)
FlowRecord五组身份(create/submit/current/forward/interfered),FlowTodoRecord三组;null读取归一化为空串;GroovyScriptRequest暴露getCreatedOperatorIdentity/getCurrentOperatorIdentity/getSubmitOperatorIdentity;FlowOperator带 identity,保留(id, name)双参构造器。三、P2:透传与隔离
FlowOperatorGatewaydefault get(id, identity),下游存量实现零改动;IRepositoryHolder.getOperatorById(id, identity)同理FlowOperatorLocalThreadCacheuserId→(userId, identity);修正批量加载按默认键登记,避免「审批人为空」operatorIdentity,2 参构造器全部保留/api/cmd/record/*、/api/query/record/*支持operatorIdentity参数,未传取当前登录身份getTodoKey#identity(operatorId, identity)过滤,默认身份用coalesce(identity,'')覆盖历史 NULLFlowRecordContent四、P3:判定升级为
(userId, identity)审批参与人校验、撤销/删除/催办/子流程重置归属校验、加签/减签/转交/委托匹配、加签待办查重、自动通过判定、干预人识别、详情/流程树/延迟触发/子流程会话的身份回查 —— 全部按人员+身份比较;身份为空时等价历史行为。
五、兼容性
ddl-auto=update自动加;旧版本不映射新列,可安全回滚coalesce(...,'')保证历史 NULL 行仍出现在默认身份列表default;请求对象保留历史构造器;WorkflowStrategyManager/IRepositoryHolder/查询服务均保留旧签名get(id, identity)返回带身份的操作者;示例已给出参考实现@Index,大表需按 DDL 手工加(见 docs)六、文档
docs/Integration/operator-identity.md:模型、SPI、请求参数、脚本用法、引擎行为、兼容性与限制;docs/Integration/sql/0.3.0-operator-identity.sql:加列 + 索引建议 + 达梦说明 + 升级自检 SQL;七、验证
./mvnw -o clean install:7 个模块全部 SUCCESS;FlowTodoKeyIdentityTest(4):默认身份键格式不变、非空身份追加后缀、两个身份不合并、同身份仍合并;FlowOperatorLocalThreadCacheTest(4):按身份隔离、null 与空串同键、加载回填、批量加载登记;OperatorIdentityPermissionTest(3):策略层同 id 异身份拒绝、审批/删除越权拒绝且正确身份放行;FlowTodoIdentityQueryTest(2,真实 H2/JPA):历史 NULL 行按默认身份可见、端到端身份落库与按身份查询。identity字段 + 0.3.0 版本锁定,pnpm build全部包通过)。Closes #288